package cn.bgs.controller;



import cn.bgs.service.Cwlservice;
import cn.bgs.utils.R;
import cn.bgs.vo.UserVo;
import cn.bgs.vo.VehicleCar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/vehicle-car")
public class VehicleCarController {
    @Autowired
    Cwlservice cwlservice;

    @RequestMapping("/selectCarInfo")
    public R selectCarInfo(@RequestBody VehicleCar vehicleCar) {
        return cwlservice.selectCarInfo(vehicleCar);
    }

    @GetMapping("/deleteInfo")
    public R deleteInfo(Integer vehicleCarId) {
        return cwlservice.deleteInfo(vehicleCarId);
    }

    @PostMapping("/addVcarInfo")
    public R addVcarInfo(@RequestBody VehicleCar vehicleCar) {
        boolean a = cwlservice.addVcarInfo(vehicleCar);
        return R.ok().data("data", a);
    }

    @PostMapping("/updateInfocar")
    public R updateInfo(@RequestBody VehicleCar vehicleCar) {
        if (cwlservice.updateInfocar(vehicleCar)) {
            return R.ok();
        }
        return R.error();
    }

    @GetMapping("/infoPc")
    public R infoPc(UserVo userVo) {
        return cwlservice.infoPc(userVo);
    }
}